Funding Overview

Column

GCF


1,578,814,635

GEF

19,028,636,363

NAPs

21

Column


Column

Readiness

Projects by Region

Amount Approved by Country

Outputs

NAP Outputs

Map

Countries with Submitted NAPs

Climate

Climate data trends for Africa. Data set: Terraclimate

Temperature - Monthly

Temperature - Annual

Precipitation - Monthly

Precipitation - Annual

Agriculture

Agricultural Productivity for selected crops. Data source: FAOSTAT

Row

Crop Yield

Total Crop Production

Row

Area harvested

Maize Crop Production

About

The Open NAPs Dashboard

Open NAPs are National Adaptation Plans for developing countries being developed through an open collaboration involving a wide range of actors, designed to support countries develop the best possible adaptation plans along the guidelines established by the UNFCCC Conference of Parties, and further elaborated through technical guidelines led by the LDC Expert Group (LEG), with continuing extension through supplements developed by a wide range of organizations.

The Open NAP initiative is moderated by the LEG under the UNFCCC. For more information about the work of the LEG, visit here

For more information about the National Adaptation Plans, browse here

For any questions or feedback, write to us

---
title: "NAP Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    source_code: embed
    
---

```{r setup, include=FALSE,echo=FALSE}
library(flexdashboard)
```


```{r global, include=FALSE}
library(RODBC)
library(magrittr)
napsdata<-odbcConnect("Open_NAPs_db")
sqlTables(napsdata)
country_codes_un<-sqlFetch(napsdata,"country_codes_un")
nap_outputs<-sqlFetch(napsdata,"nap_output_docs")%>% na.omit(nap_outputs)
Readiness<-sqlFetch(napsdata,"Readiness")
GEF<-sqlFetch(napsdata,"GEF")%>% na.omit(GEF)
GCF<-sqlFetch(napsdata,"GCF")%>% na.omit(GCF)
NAPS<-sqlFetch(napsdata,"Submitted_NAPs")
latlong<-sqlFetch(napsdata,"countrylatlong")
NAPATbl<-sqlFetch(napsdata,"project_database")
```


```{r, include=FALSE}
library(magrittr)
napcountry_outputs<-merge(country_codes_un,nap_outputs, by="country-code")
GEF_Projects<-merge(country_codes_un,GEF, by="countryname", all.y = TRUE)
GCF_Projects<-merge(country_codes_un,GCF, by="countryname", all.y = TRUE)
Country_Readiness<-merge(country_codes_un,Readiness, by="countryname", all.y = TRUE)
NAPCountries<-merge(country_codes_un,NAPS, by="countryname", all.y = TRUE)
xycountrycode<-merge(country_codes_un,latlong, by='countryname', all.x = TRUE)
NAP_Countries<-merge(NAPS,xycountrycode, by="countryname", all.x = TRUE)
NAPA<-merge(NAPATbl,xycountrycode, by="countryname", all.x = TRUE)

```


```{r,include=FALSE}

library(dplyr)
library(magrittr)
GCF_Core <- as.data.frame(GCF_Projects)%>% group_by(`countryname`)%>% 
  summarise("Total GCF Funding"=sum(`Total GCF Funding`))#%>%
      #tidyr::pivot_wider(names_from = "countryname", values_from ="Total GCF Funding")
GCF_Co_Finance <- as.data.frame(GCF_Projects)%>% group_by(`countryname`)%>% 
  summarise("Total Co-Financing"=sum(`Total Co-Financing`))
GEF_Grant <- as.data.frame(GEF_Projects)%>% group_by(`countryname`)%>% 
  summarise("Grant"=sum(`Grant`))
GEF_Co_Finance <- as.data.frame(GEF_Projects)%>% group_by(`countryname`)%>% 
  summarise("Total Co-Financing"=sum(`Co-Financing`))
Readiness_df <- as.data.frame(Country_Readiness)%>% group_by(`countryname`,Region,`Grant Agreement Type`)%>%   summarise("Amount Approved"=sum(`Amount Approved`),"Amount Disbursed"=sum(`Amount Disbursed`) )
NAPA_df <- as.data.frame(NAPA)%>% group_by(`countryname`,Region,Fund,status)%>%   summarise("Amount Approved"=sum(Amount) )
NAPA_New<-NAPA_df[-90,]
```
Funding Overview
=======================================================================
Column { data-width=50 }
-----------------------------------------------------------------------
### GCF {.value-box}

-----------------------------------------------------------------------



```{r}
gcf_total<-sum(GCF_Core$`Total GCF Funding`)

valueBox(value = prettyNum(format(gcf_total,big.mark = ","), "", sep = ","),
         caption = "Total GCF Funding", 
         icon = "logo-usd", 
         color = "brown")
```


### GEF {.value-box} 


```{r}
gef_total<-sum(GEF_Grant$Grant)

valueBox(value = prettyNum(format(gef_total,big.mark = ","), "", sep = ","),
         caption = "Total GEF Funding", 
         icon = "logo-usd", 
         color = "orange")
```

### NAPs {.value-box} 

```{r}
naps_total<-count(NAPS)

valueBox(value = prettyNum(format(naps_total,big.mark = ","), "", sep = ","),
         caption = "NAPs Submitted", 
         icon = "document-text-outline", 
         color = "green")
```

Column { data-width=50 }
-----------------------------------------------------------------------

```{r}
library(ggplot2)
library(treemapify)
ggplot(data = GCF_Core, aes(fill=countryname, area=`Total GCF Funding`, label = paste(countryname,"\n",prettyNum(`Total GCF Funding`, big.mark = ","))))+
  geom_treemap()+
  geom_treemap_text(colour='black', place='centre')+
  labs(subtitle = 'GCF Projects Funding by Country')+
  theme(legend.position = 'none')
```

-----------------------------------------------------------------------

```{r}
library(ggplot2)
library(treemapify)
ggplot(data = subset(GEF_Grant,`Grant`>50000000), aes(fill=countryname, area=Grant, label = paste(countryname,"\n",prettyNum(Grant, big.mark = ","))))+
  geom_treemap()+
  geom_treemap_text(colour='black', place='centre')+
  labs(subtitle = 'GEF Project Grants by Country')+
  theme(legend.position = 'none')
 
```


Column { data-width=50 } 
-----------------------------------------------------------------------

```{r echo=FALSE}
library(ggplot2)
library(ggplotlyExtra)
library(treemapify)
ggplot(data = NAPA_df, aes(fill=countryname, area=NAPA_df$`Amount Approved`, label = paste(countryname,"\n",prettyNum(`Amount Approved`, big.mark = ","))))+
  geom_treemap()+
  geom_treemap_text(colour='black', place='centre')+
  labs(subtitle = 'NAPA Funding by Country')+
  theme(legend.position = 'none')
#ggplotly(x)
```


Readiness
========================================================================

### Projects by Region

```{r echo=FALSE, message=FALSE, warning=FALSE}
library(plotly)
library(dplyr)
library(base)
Country_Readiness %>% count(Country_Readiness$`Project Title`)%>%na.omit(Country_Readiness)%>%
   plot_ly(type = "bar", 
          y = Country_Readiness$`Project Title`, 
          x = Country_Readiness$Region)
```

### Amount Approved by Country

```{r,echo=FALSE}
library(plotly)
Readiness_df%>%arrange()%>%
   plot_ly(type = "bar", 
          x = Readiness_df$`Amount Approved`, 
          y = Readiness_df$countryname

                   )
```

Outputs
========================================================================

### NAP Outputs

```{r, echo=FALSE, warning=FALSE,message=FALSE}
library(DT)
library(rio)

y<-napcountry_outputs[,c(2,5,7,12,11)]
datatable(y,filter = 'top',fillContainer = T,rownames = F, editable = F, style = 'foundation', class = 'display responsive', width = '100%', caption = "NAP Output Documents", extensions = 'Buttons', options=list(initComplete = JS("function(settings, json) {$(this.api().table().header()).css({'font-size' : '70%'});}"),pageLength= 10, dom='lfrtipB', buttons = c('copy', 'csv', 'excel', 'pdf')))%>%
  DT::formatStyle(columns = colnames(y),fontSize= '10px')

```

Map
========================================================================

### Countries with Submitted NAPs

```{r,echo=FALSE}
library(leaflet)
library(dplyr)
library(ggplot2)
library(tidyverse)
NAP_Countries<-NAP_Countries%>%
   mutate(popup_info=paste(countryname,"
","Submitted on:",NAP_Countries$`Date of submission`,"
","Link",NAP_Countries$Link)) leaflet(NAP_Countries)%>% addTiles()%>% addCircleMarkers(data=NAP_Countries, fill=T,lng=~lon, lat =~lat, radius = ~4,popup =~popup_info) ``` Climate {data-orientation=columns} ======================================================================== Climate data trends for Africa. Data set: [Terraclimate](https://developers.google.com/earth-engine/datasets/catalog/IDAHO_EPSCOR_TERRACLIMATE) {.tabset .tabset-fade} ------------------------------------- ```{r, include=FALSE,echo=FALSE} library(rgee) library(raster) ee_Initialize() Tmax<-ee$ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")$ select('tmmx') library(sf) Tru<-read_sf("C:/Workspace/RMardown_NAPS/Africa_Trace.shp") TmaxAfrica<-ee_extract(x=Tmax, y=Tru, fun=ee$Reducer$mean()) library(tidyverse) Tmaxlong<-pivot_longer(TmaxAfrica,everything(),names_to = 'month',values_to = 'tmax') Date<-seq(as.Date('1958-01-01'), by="month", length.out=757) Tmaxlong$Date<-Date library(lubridate) tmax_ann<-Tmaxlong%>%mutate(year=year(Date), month=month(Date))%>% group_by(year)%>% summarise(tmax=sum(tmax)) library(xts) tmax_ts<-xts(Tmaxlong$tmax,Tmaxlong$Date) ``` ### Temperature - Monthly ```{r} library(dygraphs) dygraph(tmax_ts, main = "Monthly Temperature Time Series") %>% dyRangeSelector(dateWindow = c("1958-01-01", "2020-12-01")) ``` ### Temperature - Annual ```{r} library(dygraphs) dygraph(tmax_ann, main = "Annual Temperature Time Series") %>% dyRangeSelector(dateWindow = c("1958-01-01", "2020-12-01")) ``` {.tabset } -------------------------------------------------------------- ```{r echo=FALSE, include=FALSE} library(rgee) library(raster) ee_Initialize() pr<-ee$ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")$select('pr') library(sf) Tru<-read_sf("C:/Workspace/RMardown_NAPS/Africa_Trace.shp") prAfrica<-ee_extract(x=pr, y=Tru, fun=ee$Reducer$mean()) library(tidyverse) prlong<-pivot_longer(prAfrica,everything(),names_to = 'month',values_to = 'pr') Date<-seq(as.Date('1958-01-01'), by="month", length.out=757) prlong$Date<-Date library(lubridate) pr_ann<-prlong%>%mutate(year=year(Date), month=month(Date))%>% group_by(year)%>% summarise(pr=sum(pr)) library(xts) pr_ts<-xts(prlong$pr,prlong$Date) ``` ### Precipitation - Monthly ```{r} library(dygraphs) dygraph(pr_ts, main = "Monthly Time Series") %>% dyRangeSelector(dateWindow = c("1958-01-01", "2020-12-01")) ``` ### Precipitation - Annual ```{r} library(dygraphs) dygraph(pr_ann, main = "Annual Time Series") %>% dyRangeSelector(dateWindow = c("1958-01-01", "2020-12-01")) ``` Agriculture {data-orientation=rows} ======================================================================== Agricultural Productivity for selected crops. Data source: [FAOSTAT](http://www.fao.org/faostat/en/#data) ```{r, echo=FALSE} library(FAOSTAT) data_folder <- "FAOSTATs" dir.create(data_folder) production_crops <- get_faostat_bulk(code = "QC", data_folder = data_folder) #saveRDS(production_crops, "FAOSTATs/production_crops_e_all_data.rds") #production_crops <- readRDS("FAOSTATs/production_crops_e_all_data.rds") ``` Row -------------------------------------------------------------------------- ### Crop Yield ```{r, echo=FALSE} library(dplyr) library(xts) library(magrittr) library(timeSeries) library(dygraphs) selectcrops<-production_crops%>% na.omit()%>%group_by(item,element,year)%>% summarise(value=sum(value))%>% dplyr::filter(element=="Yield")%>%dplyr::filter(item=="Maize" | item=="Yams" |item=="Apples"|item=="Avocados"|item=="Bananas"|item=="Barley"|item=="Beans,green"|item=="Beans,dry"|item=="Cassava"|item=="Cereals,Total"|item=="Dates"|item=="Onions, dry"|item=="Lentils"|item=="Millet"|item=="Oats"|item=="Olives"|item=="Oil palm fruit"|item=="Potoatoes"|item=="Pulses,Total"|item=="Rice,paddy"|item=="Sorghum"|item=="Soybeans"|item=="Tea"|item=="Tomatoes"|item=="Vegetables Primary"|item=="Wheat") library(ggplot2) xcrop<- ggplot2::ggplot(selectcrops,aes(x=year, y=value, color=item))+ ggtitle('Global Crop Yield - Annual Trends')+ xlab('Time')+ylab('Yield (hg/ha)')+ geom_line()+ theme_minimal() plotly::ggplotly(xcrop) ``` ### Total Crop Production ```{r} library(dplyr) library(xts) library(magrittr) library(timeSeries) library(dygraphs) production<-production_crops%>% na.omit()%>%group_by(item,element,year)%>% summarise(value=sum(value))%>% dplyr::filter(element=="Production")%>%dplyr::filter(item=="Maize" | item=="Yams" |item=="Apples"|item=="Avocados"|item=="Bananas"|item=="Barley"|item=="Beans,green"|item=="Beans,dry"|item=="Cassava"|item=="Cereals,Total"|item=="Dates"|item=="Onions, dry"|item=="Lentils"|item=="Millet"|item=="Oats"|item=="Olives"|item=="Oil palm fruit"|item=="Potoatoes"|item=="Pulses,Total"|item=="Rice,paddy"|item=="Sorghum"|item=="Soybeans"|item=="Tea"|item=="Tomatoes"|item=="Vegetables Primary"|item=="Wheat") library(ggplot2) xprod<- ggplot2::ggplot(production,aes(x=year, y=value, color=item))+ ggtitle('Global Crop Production - Annual Trends')+ xlab('Time')+ylab('Tonnes')+ geom_line()+ theme_minimal() plotly::ggplotly(xprod) ``` Row ----------------------------------------------------------------- ### Area harvested ```{r} library(dplyr) library(xts) library(magrittr) library(timeSeries) library(dygraphs) Area_harvested<-production_crops%>%na.omit()%>% group_by(item,element,year)%>% summarise(value=sum(value))%>% dplyr::filter(element=="Area harvested")%>%dplyr::filter(item=="Maize" | item=="Yams" |item=="Apples"|item=="Avocados"|item=="Bananas"|item=="Barley"|item=="Beans,green"|item=="Beans,dry"|item=="Cassava"|item=="Cereals,Total"|item=="Dates"|item=="Onions, dry"|item=="Lentils"|item=="Millet"|item=="Oats"|item=="Olives"|item=="Oil palm fruit"|item=="Potoatoes"|item=="Pulses,Total"|item=="Rice,paddy"|item=="Sorghum"|item=="Soybeans"|item=="Tea"|item=="Tomatoes"|item=="Vegetables Primary"|item=="Wheat") library(ggplot2) area<- ggplot2::ggplot(Area_harvested,aes(x=year, y=value, color=item))+ ggtitle('Annual Global Crop Trends - Area Harvested')+ xlab('Time')+ylab('Area harvested (ha)')+ geom_line()+ theme_minimal() plotly::ggplotly(area) ``` ### Maize Crop Production ```{r, echo=FALSE} library(dplyr) library(xts) library(magrittr) library(timeSeries) library(dygraphs) Maize<-production_crops%>% na.omit()%>%group_by(item,element,year)%>% summarise(value=sum(value))%>% dplyr::filter(item=="Maize") library(ggplot2) Maizecrop<- ggplot2::ggplot(Maize,aes(x=year, y=value, color=element))+ ggtitle('Global Maize Production Trends')+ xlab('Time')+ylab('value')+ geom_line()+ theme_minimal() plotly::ggplotly(Maizecrop) ``` About ======================================================================== _The Open NAPs Dashboard_ Open NAPs are National Adaptation Plans for developing countries being developed through an open collaboration involving a wide range of actors, designed to support countries develop the best possible adaptation plans along the guidelines established by the UNFCCC Conference of Parties, and further elaborated through technical guidelines led by the LDC Expert Group (LEG), with continuing extension through supplements developed by a wide range of organizations. The Open NAP initiative is moderated by the LEG under the UNFCCC. For more information about the work of the LEG, visit [here](https://unfccc.int/LEG) For more information about the National Adaptation Plans, [browse here](https://napcentral.netlify.app/open-naps/) For any questions or feedback, [write to us](opennaps@naps.org)